package com.example.mindadinner.net;

import java.io.IOException;

import com.example.mindadinner.net.request.NetServiceMeta;


public class NetServiceClient {

	public synchronized <REQ extends NetRequest, RES extends NetResponse> RES excute(
			final REQ request)  throws IOException, ApiException {
		final NetServiceMeta meta = NetServiceMeta.getNetServiceMeta(request.getClass());
			try {
				NetResponse netRespons=meta.getResponseType().newInstance();
				return netRespons.getResponseFromRequest(request);
			} catch (InstantiationException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				e.printStackTrace();
			}
		
		return null;
	}
}
